@extends('Admin.Layouts.index')

@section('active2')
    active
@endsection

@section('title_name')
    用户回收站
@endsection

@section('container')
    <div class="container">
        <div class="mws-panel grid_8">
            <div class="mws-panel-header">
                <span><i class="icon-table"></i> 用户回收站 </span>
            </div>
            <div class="mws-panel-body no-padding">
                <div id="DataTables_Table_1_wrapper" class="dataTables_wrapper" role="grid">

                    <form action="/admin/user/trash" method="get">
                        <div id="DataTables_Table_1_length" class="dataTables_length">
                            <label>
                                显示
                                <select size="1" name="num" aria-controls="DataTables_Table_1">
                                    <option value="10" onclick="location.href='/admin/user/trash?num=10{{$keywords}}{{$authUrl}}'" @if($num == 10) selected @endif>10</option>
                                    <option value="25" onclick="location.href='/admin/user/trash?num=25{{$keywords}}{{$authUrl}}'" @if($num == 25) selected @endif>25</option>
                                    <option value="50" onclick="location.href='/admin/user/trash?num=50{{$keywords}}{{$authUrl}}'" @if($num == 50) selected @endif>50</option>
                                    <option value="100" onclick="location.href='/admin/user/trash?num=100{{$keywords}}{{$authUrl}}'" @if($num == 100) selected @endif>100</option>
                                </select>
                                条数据
                            </label>
                        </div>
                        <div id="DataTables_Table_1_length" class="dataTables_length">
                            <label>
                                权限筛选
                                <select size="1" name="auth" aria-controls="DataTables_Table_1">
                                    <option value="" onclick="location.href='/admin/user/trash?{{$keywords}}{{$numUrl}}'" @if($auth == '') selected @endif>不限</option>
                                    <option value="1" onclick="location.href='/admin/user/trash?auth=1{{$keywords}}{{$numUrl}}'" @if($auth == 1) selected @endif>超级管理员</option>
                                    <option value="2" onclick="location.href='/admin/user/trash?auth=2{{$keywords}}{{$numUrl}}'" @if($auth == 2) selected @endif>普通管理员</option>
                                    <option value="3" onclick="location.href='/admin/user/trash?auth=3{{$keywords}}{{$numUrl}}'" @if($auth == 3) selected @endif>普通用户</option>
                                </select>
                            </label>
                        </div>
                        <div class="dataTables_filter" id="DataTables_Table_1_filter">
                            <label>关键字: <input aria-controls="DataTables_Table_1" name="keywords" type="text" value="{{$request->keywords}}">
                                <button type="submit" class="btn btn-primary">搜索</button>
                                <button type="button" class="btn btn-danger" onclick="location.href='/admin/user/trash?auth={{$numUrl}}'">撤销条件</button>
                            </label>
                        </div>
                    </form>


                    <table class="mws-datatable-fn mws-table dataTable" id="DataTables_Table_1"
                           aria-describedby="DataTables_Table_1_info">
                        <thead>
                        <tr role="row">
                            <th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1"
                                rowspan="1" colspan="1" style="width: 169px;" aria-sort="ascending"
                                aria-label="Rendering engine: activate to sort column descending">ID
                            </th>
                            <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1"
                                rowspan="1" colspan="1" style="width: 229px;"
                                aria-label="Browser: activate to sort column ascending">用户名
                            </th>
                            <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1"
                                rowspan="1" colspan="1" style="width: 213px;"
                                aria-label="Platform(s): activate to sort column ascending">状态
                            </th>
                            <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1"
                                rowspan="1" colspan="1" style="width: 145px;"
                                aria-label="Engine version: activate to sort column ascending">权限
                            </th>
                            <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1"
                                rowspan="1" colspan="1" style="width: 106px;"
                                aria-label="CSS grade: activate to sort column ascending">注册时间
                            </th>
                            <th class="sorting" tabindex="0" aria-controls="DataTables_Table_1"
                                rowspan="1" colspan="1" style="width: 106px;"
                                aria-label="CSS grade: activate to sort column ascending">操作
                            </th>

                        </tr>
                        </thead>

                        <tbody role="alert" aria-live="polite" aria-relevant="all" style="text-align: center">

                        @if(count($users) > 0)
                            @foreach($users as $k=>$v)
                                @if($k %2 == 1)
                                    <tr class="odd">
                                @else
                                    <tr class="even">
                                @endif
                                        <td class="  sorting_1">{{$v['id']}}</td>
                                        <td class=" ">{{$v['username']}}</td>
                                        <td class=" ">{{showStatus($v['status'])}}</td>
                                        <td class=" ">{{showAuth($v['auth'])}}</td>
                                        <td class=" ">{{$v['created_at']}}</td>
                                        <td class=" ">
                                            <a href="/admin/user/trash/recover?id={{$v['id']}}" alt="恢复用户" class="btn btn-small"><i class="icon-eject"></i></a>
                                            <a href="/admin/user/trash/del?id={{$v['id']}}"  alt="删除用户" class="btn btn-small"><i class="icon-trash"></i></a>
                                        </td>
                                    </tr>
                            @endforeach
                        @else
                            <tr><td colspan="5">暂无数据</td></tr>
                        @endif
                        </tbody>
                    </table>
                    <div class="dataTables_info" id="DataTables_Table_1_info">显示第 {{($users->currentPage()-1) * $users->perPage() +1}} 到第 {{($users->currentPage()-1) * $users->perPage() + $users->count()}} 条数据 共 {{$users->total()}} 条数据</div>
                    <div class="dataTables_paginate paging_full_numbers" id="page">
                        {!! $users->appends($request->all())->render() !!}
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection